package ecom.appcode.common.utility;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

import ecom.appcode.common.constants.CommonConstants;

public class DBUltils {
    public static Connection makeConnection() {
        try {
            /** database dynamic. */
            ResourceBundle rb = ResourceBundle.getBundle("DB");
            Class.forName(rb.getString("driver"));
            String url = rb.getString("url");
            Connection con = DriverManager.getConnection(url, rb.getString(CommonConstants.USER_NAME),
                    rb.getString(CommonConstants.PASSWORD));
            return con;
        } catch (SQLException ex) {
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return null;
    }
}
